package com.hwadee.controller;

import com.hwadee.pojo.Reportinfo;
import com.hwadee.service.ReportinfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/api/hd")
public class ReportinfoController {

    @Autowired
    private ReportinfoService service;

    @GetMapping("/getreportlist")
    public List<Reportinfo> getAllReportinfo() {
        return service.getAllReportinfo();
    }

    @PostMapping("/addreport")
    public void addReport(@RequestBody Reportinfo reportinfo) {
        service.addReport(reportinfo);
    }

    @PostMapping("/updatereport")
    public void updateReport(@RequestBody Reportinfo reportinfo) {
        service.updateReport(reportinfo);
    }

    @GetMapping("/delreport/{id}")
    public void deleteReport(@PathVariable Integer id) {
        service.deleteReportById(id);
    }

}
